package com.hairline.service;

import com.hairline.bean.User;
import com.hairline.bean.bo.FeedbackBO;
import com.hairline.mapper.FeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WxFeedbackServiceImpl implements WxFeedbackService {

    @Autowired
    FeedbackMapper feedbackMapper;

    @Override
    public void feedbackSubmit(FeedbackBO feedbackBO, User user) {
        feedbackBO.setUserId(user.getId());
        feedbackBO.setUsername(user.getUsername());
        feedbackBO.setStatus(0);
        if (feedbackBO.getPicUrls().size() == 0) {
            feedbackBO.setHasPicture(false);
        } else {
            feedbackBO.setHasPicture(true);
            feedbackBO.setPicUrlsForDB(feedbackBO.getPicUrls().toString());
        }
        feedbackMapper.insertNewFeedback(feedbackBO);
    }
}
